class SRHighROFFire extends KFHighROFFire;

var float DamageStaminaExpenceRate;
var bool bSilentWeapon,bSaboteurWeap;
var float InvisExpence;

event ModeDoFire()
{
	local float xvel,yvel;

	xvel = Weapon.Owner.Velocity.x;
	yvel = Weapon.Owner.Velocity.y;

	SRHumanPawn(Instigator).ConsumeStamina(WeaponStaminaCost());
	Super.ModeDoFire();
	
	if ( SRPlayerReplicationInfo(Instigator.PlayerReplicationInfo).ClientVeteranSkill.default.PerkIndex == class'SRVetSaboteur'.default.PerkIndex && bSaboteurWeap )
	Weapon.Owner.Velocity.x = xvel * 1.09;
	Weapon.Owner.Velocity.y = yvel * 1.09;
}

function DoFireEffect()
{
    local Vector StartTrace;
    local Rotator R, Aim;

	if ( !bSilentWeapon || !SRHumanPawn(Instigator).bInvisible )
	{
		Instigator.MakeNoise(1.0);
		SRHumanPawn(Instigator).BecomeVisible();
	}
	else
	{
		//SRHumanPawn(Instigator).InvisibilityCharge -= InvisExpence;
	}

    // the to-hit trace always starts right in front of the eye
    StartTrace = Instigator.Location + Instigator.EyePosition();
    Aim = AdjustAim(StartTrace, AimError);
	R = rotator(vector(Aim) + VRand()*FRand()*Spread);
    DoTrace(StartTrace, R);
}

function float WeaponStaminaCost()
{
	local KFWeapon KFW;
	local float ExpenceMod;
	
	KFW = KFWeapon(Weapon);
	
	if ( KFW == none )
		return 0.0;
		
	ExpenceMod = 1.0;

	ExpenceMod *= class'SRVeterancy'.Static.AddDamage(SRPlayerReplicationInfo(Instigator.Controller.PlayerReplicationInfo),none,none,10000,DamageType) * 0.0001;

	return DamageMax * ExpenceMod * DamageStaminaExpenceRate;
	
	return 0.0;
}

defaultproperties
{
	bSaboteurWeap = false
	DamageStaminaExpenceRate = 0.002;
	bSilentWeapon = false;
	InvisExpence = 0.00;
}
